package ControllerLayer;
import ModelLayer.*;

/**
 * Write a description of class ItemController here.
 * 
 * @author (Ulrik) 
 * @version (28052013)
 */
public class WarehouseController
{
    // instance variables - 
	private ItemContainer items;
	private WarehouseContainer warehouse;
    /**
     * Constructor for ItemController, it is only containing the essential code,
     * for completion of the iteration.
     */
    public WarehouseController()
    {
    	items = ItemContainer.getInstance();
    	warehouse = WarehouseContainer.getInstance();
    }

    /**
     * Method to getItem, where it is creates an item, based on the Input ItemId,
     * and returns Item object.
     * 
     * @param int ItemId
     * @return Item
     */
    public Warehouse addWareHouse(String name)
    {
    	Warehouse w = new Warehouse(name);
    	warehouse.addWarehouse(w);
    	return w;
    }
    
    public Item addItem(int id, String name, double salesPrice, String defaultKolli)
    {
    	Item i = new Item(id, name, salesPrice, defaultKolli);
    	items.addItem(i);
    	return i;
    }
    
    public Item getItem(int itemId)
    {
        /*
    	if(ItemId == 1)
        {
            Item i = new Item(1, "Screws ½ inch", 10.0);
            return i;
        }
        else if(ItemId == 2)
        {
            Item i = new Item(2, "Plank 5 foot", 20.0);
            return i;
        }
        else if(ItemId == 3)
        {
            Item i = new Item(3, "Nails ½ inch", 30.0);
            return i;
        }
        else if(ItemId == 4)
        {
            Item i = new Item(4, "Nails 1½ inch", 40.0);
            return i;
        }
        else
        {
            Item i = new Item(5, "Hammer", 50.0);
            return i;
        }
        */
    	return items.getItem(itemId);
    }
}